<div id="common-form-view" class="common-form-view">
    <form p-bind="id:{{id}}^lay-filter:{{id}}" class="layui-form model-form" p-each="form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item" p-bind="id:layui-form-item-{{field}}">
            <label class="layui-form-label">{{title}}</label>
            <!-- text number phone email password -->
            <div class="layui-input-block" p-if="{{code}}==1">
                <input p-bind="type:{{type}}^name:{{field}}^placeholder:{{placeholder}}^id:{{field}}" autocomplete="off"
                       class="layui-input"/>
            </div>
            <!-- 复选框/单选框  -->
            <div class="layui-input-block" p-if="{{code}}==2" p-each="items">
                <input p-bind="type:{{type}}^name:{{field}}^value:{{value}}^title:{{title}}^lay-filter:{{field}}" autocomplete="off"/>
            </div>
            <!-- 下拉框 -->
            <div class="layui-input-block" p-if="{{code}}==3">
                <select p-if="{{code}}==3" p-each="items" p-bind="name:{{field}}^id:{{field}}">
                    <option p-bind="value:{{value}}">{{title}}</option>
                </select>
            </div>
            <!-- 日期选择 -->
            <div class="layui-input-block" p-if="{{code}}==4">
                <input type="text" lay-verify="date" p-bind="name:{{field}}^placeholder:{{placeholder}}^id:{{field}}" autocomplete="off"
                       class="layui-input"/>
            </div>

            <!-- 文本域 -->
            <div class="layui-input-block" p-if="{{code}}==5">
                <textarea p-bind="name:{{field}}^placeholder:{{placeholder}}" class="layui-textarea"
                          autocomplete="off"></textarea>
            </div>
            <!-- 开关 -->
            <div class="layui-input-block" p-if="{{code}}==6">
                <input type="checkbox" p-bind="name:{{field}}^lay-text:{{text}}" lay-skin="switch">
            </div>
            <!-- 编辑器 -->
            <div class="layui-input-block" p-if="{{code}}==7">
                <textarea p-bind="id:{{field}}" class="layui-textarea"></textarea>
            </div>
            <!-- 上传单张图片 -->
            <div class="layui-upload ayui-input-block" p-if="{{code}}==8">
                <button type="button" class="layui-btn" p-bind="id:{{field}}">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" style="margin: 0 110px;max-height:200px;">
                </div>
            </div>
            <!-- 上传多张图片 -->
            <div class="layui-upload ayui-input-block" p-if="{{code}}==9">
                <button type="button" class="layui-btn" p-bind="id:{{field}}">上传图片</button>
                <blockquote class="layui-elem-quote layui-quote-nm" p-bind="id:layui-upload-item-{{field}}" style="margin: 10px 0 0 0px;">
                    预览图：
                    <div class="layui-upload-list" style="display: flex;"></div>
                </blockquote>
            </div>

            <!--上传文件-->
            <div class="layui-upload ayui-input-block" p-if="{{code}}==10">
                <button type="button" class="layui-btn" p-bind="id:{{field}}"><i class="layui-icon"></i>上传文件</button>
                <div class="layui-upload-list" p-bind="id:layui-upload-item-{{field}}">
                    <div class="layui-upload-list" style="margin: 10px 0 0 110px;"></div>
                </div>
            </div>

            <!-- 下拉树结构 -->
            <div class="layui-upload ayui-input-block" p-if="{{code}}==11" >
                <div class="layui-input-block" style="position:relative;">
                    <input type="text" name="deptName" autocomplete="off" class="layui-input"
                           onclick="selectDept()" readonly="readonly">
                    <input type="hidden" name="parentId" required lay-verify="parentId">

                    <div style="height:200px;overflow-y: auto;display: none;position:absolute;left:0px;right:0px;z-index: 5;background:#fff;border: 1px solid #eaeaea;"
                         id="deptPop">
                        <ul p-bind="id:{{id}}"></ul>
                    </div>
                </div>
            </div>

            <!--附加信息-->
            <div class="extend-cot" p-if="{{code}}==12">
                <button type="button" class="layui-btn add-btn layui-btn-sm"
                        onclick="javascript:$('.extend-cot').toggleClass('setting-hide')">
                    添加附加信息
                </button>
                <div class="extend-edit">
                    <label>字段名</label>
                    <input type="text" name="key">
                    <label>字段值</label>
                    <input type="text" name="val">
                    <button type="button" class="layui-btn layui-btn-sm"
                            onclick="soda.form.extendAdd(this)">
                        确定
                    </button>
                </div>
                <div class="extend-detail" p-bind="id:{{field}}">
                    <div class="line title">
                        <div class="item">字段名</div>
                        <div class="item">字段值</div>
                        <div class="item">操作</div>
                    </div>
                    <div class="content">
                    </div>
                </div>
            </div>
            <!--下拉多选-->
            <div p-if="{{code}}==16" p-bind="id:{{field}}^class:{{class}}" class="layui-input-block">

            </div>
            <!--查询选择输入框-->
            <div class="layui-input-cot-block" p-if="{{code}}==17">
                <div class="layui-form-select  layui-form-selectup" style="position:relative;">
                    <div class="layui-input-cot-block">
                        <input type="text"
                               p-bind="name:{{field}}^placeholder:{{placeholder}}^id:{{field}}^dataType:{{type}}"
                               class="layui-input">
                        <i class="layui-edge"></i>
                        <input type="hidden" p-bind="name:{{id}}">
                    </div>
                    <dl class="layui-anim layui-anim-upbit"
                        style="position:absolute;left:0px;right:0px;top:35px;max-height:200px;bottom:auto">
                        <dd lay-value="" class="layui-select-tips layui-this">请选择</dd>
                        <div class="list">
                        </div>
                    </dl>
                </div>
            </div>
        </div>
        <!--查看表格数据-->
        <div p-if="{{code}}==14" style="padding-left:35px;">
            <table class="layui-hide" p-bind="id:{{field}}^lay-filter:{{field}}"></table>
        </div>
        <!--导入数据-->
        <div p-if="{{code}}==15" style="padding-left:35px;margin-top:-15px;">
            <input type="file" p-bind="dataType:{{dataType}}^id:{{field}}"
                   onchange="soda.form.importOpt.importData(this)">
            <div class="data-table"></div>
        </div>
    </form>
</div>